/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.logikas.hipokrates.server.domain.hl7;

import java.io.Serializable;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author csrinaldi
 */
@Entity
@Table(name = "Hl7Person")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Hl7Person.findAll", query = "SELECT h FROM Hl7Person h"),
    @NamedQuery(name = "Hl7Person.findByIdLivingSubject", query = "SELECT h FROM Hl7Person h WHERE h.idLivingSubject = :idLivingSubject"),
    @NamedQuery(name = "Hl7Person.findByMaritalStatusCode", query = "SELECT h FROM Hl7Person h WHERE h.maritalStatusCode = :maritalStatusCode"),
    @NamedQuery(name = "Hl7Person.findByEducationLevelCode", query = "SELECT h FROM Hl7Person h WHERE h.educationLevelCode = :educationLevelCode"),
    @NamedQuery(name = "Hl7Person.findByDisabilityCode", query = "SELECT h FROM Hl7Person h WHERE h.disabilityCode = :disabilityCode"),
    @NamedQuery(name = "Hl7Person.findByLivingArrangementCode", query = "SELECT h FROM Hl7Person h WHERE h.livingArrangementCode = :livingArrangementCode"),
    @NamedQuery(name = "Hl7Person.findByReligiousAffiliationCode", query = "SELECT h FROM Hl7Person h WHERE h.religiousAffiliationCode = :religiousAffiliationCode"),
    @NamedQuery(name = "Hl7Person.findByRaceCode", query = "SELECT h FROM Hl7Person h WHERE h.raceCode = :raceCode"),
    @NamedQuery(name = "Hl7Person.findByEthnicGroupCode", query = "SELECT h FROM Hl7Person h WHERE h.ethnicGroupCode = :ethnicGroupCode")})
public class Hl7Person implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id_living_subject")
    private Long idLivingSubject;
    @Basic(optional = false)
    @Column(name = "maritalStatusCode")
    private int maritalStatusCode;
    @Basic(optional = false)
    @Column(name = "educationLevelCode")
    private int educationLevelCode;
    @Column(name = "disabilityCode")
    private Integer disabilityCode;
    @Basic(optional = false)
    @Column(name = "livingArrangementCode")
    private int livingArrangementCode;
    @Basic(optional = false)
    @Column(name = "religiousAffiliationCode")
    private int religiousAffiliationCode;
    @Basic(optional = false)
    @Column(name = "raceCode")
    private int raceCode;
    @Basic(optional = false)
    @Column(name = "ethnicGroupCode")
    private int ethnicGroupCode;
    @JoinColumn(name = "id_living_subject", referencedColumnName = "id_entity", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Hl7LivingSubject hl7LivingSubject;

    public Hl7Person() {
    }

    public Hl7Person(Long idLivingSubject) {
        this.idLivingSubject = idLivingSubject;
    }

    public Hl7Person(Long idLivingSubject, int maritalStatusCode, int educationLevelCode, int livingArrangementCode, int religiousAffiliationCode, int raceCode, int ethnicGroupCode) {
        this.idLivingSubject = idLivingSubject;
        this.maritalStatusCode = maritalStatusCode;
        this.educationLevelCode = educationLevelCode;
        this.livingArrangementCode = livingArrangementCode;
        this.religiousAffiliationCode = religiousAffiliationCode;
        this.raceCode = raceCode;
        this.ethnicGroupCode = ethnicGroupCode;
    }

    public Long getIdLivingSubject() {
        return idLivingSubject;
    }

    public void setIdLivingSubject(Long idLivingSubject) {
        this.idLivingSubject = idLivingSubject;
    }

    public int getMaritalStatusCode() {
        return maritalStatusCode;
    }

    public void setMaritalStatusCode(int maritalStatusCode) {
        this.maritalStatusCode = maritalStatusCode;
    }

    public int getEducationLevelCode() {
        return educationLevelCode;
    }

    public void setEducationLevelCode(int educationLevelCode) {
        this.educationLevelCode = educationLevelCode;
    }

    public Integer getDisabilityCode() {
        return disabilityCode;
    }

    public void setDisabilityCode(Integer disabilityCode) {
        this.disabilityCode = disabilityCode;
    }

    public int getLivingArrangementCode() {
        return livingArrangementCode;
    }

    public void setLivingArrangementCode(int livingArrangementCode) {
        this.livingArrangementCode = livingArrangementCode;
    }

    public int getReligiousAffiliationCode() {
        return religiousAffiliationCode;
    }

    public void setReligiousAffiliationCode(int religiousAffiliationCode) {
        this.religiousAffiliationCode = religiousAffiliationCode;
    }

    public int getRaceCode() {
        return raceCode;
    }

    public void setRaceCode(int raceCode) {
        this.raceCode = raceCode;
    }

    public int getEthnicGroupCode() {
        return ethnicGroupCode;
    }

    public void setEthnicGroupCode(int ethnicGroupCode) {
        this.ethnicGroupCode = ethnicGroupCode;
    }

    public Hl7LivingSubject getHl7LivingSubject() {
        return hl7LivingSubject;
    }

    public void setHl7LivingSubject(Hl7LivingSubject hl7LivingSubject) {
        this.hl7LivingSubject = hl7LivingSubject;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idLivingSubject != null ? idLivingSubject.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Hl7Person)) {
            return false;
        }
        Hl7Person other = (Hl7Person) object;
        if ((this.idLivingSubject == null && other.idLivingSubject != null) || (this.idLivingSubject != null && !this.idLivingSubject.equals(other.idLivingSubject))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.logikas.hipokrates.server.domain.hl7.Hl7Person[ idLivingSubject=" + idLivingSubject + " ]";
    }
    
}
